@extends("backend.layout.main")

@section("before.css")
    <link type="text/css" href="/backend/css/common.css" rel="Stylesheet">
    <link type="text/css" href="/backend/css/header.css" rel="Stylesheet">
    <link type="text/css" href="/backend/css/style.css" rel="Stylesheet">
    <link type="text/css" href="/backend/css/style2.css" rel="Stylesheet">
    <link type="text/css" href="/backend/css/project.css" rel="Stylesheet">

    <script src="/backend/js/modal.js"></script>
    <script src="/backend/js/laydate.js"></script>
    <script src="/backend/js/distpicker.data.js"></script>
    <script src="/backend/js/distpicker.js"></script>
    <script src="/backend/js/jquery.validate.js"></script>
    <script src="/backend/js/validate_zh.js"></script>

    <script type="text/javascript">
        !function(){
            laydate({elem: '#demo'});//绑定元素
        }();

        $(function(){
            $("#shenshi").distpicker();
            $('.perMesg').mouseenter(function(){
                $(this).find('dd').addClass('showTrsm');
            }).mouseleave(function(){
                $(this).find('dd').removeClass('showTrsm');
            })
        })

    </script>
    <script>
        function checkAddProject() {
            return $('#frmProject').validate({
                rules: {
                    'project.name': {
                        required: true,
                        maxlength: 100
                    },
                    'project.expectStartDate': {
                        date: true,
                        required: true
                    },
                    'project.expectFinishDate': {
                        date: true,
                        required: true,
                        date_range: function () {
                            return {
                                format: datepickerDateFormat,
                                displayFormat: displayDateFormat,
                                fromDate: $("#expectStartDate").val()
                            }
                        }
                    },

                },
                errorPlacement: function (error, element) {
                    if (element.attr("type") != 'radio') {
                        error.css("padding-top", '8px')
                    }
                    error.css("padding-left", '8px')
                    element.parent().append(error);
                }
            }).form();
        }

        function checkProject() {
            if (checkAddProject()) {
                var f = false;
                $("input[name=linkmanIds]").each(function () {
                    if (this.checked) {
                        f = true;
                        return;
                    }
                })
                /*
                 if (!f) {
                 alert("请选择客户联系人");
                 return false;
                 }
                 */
                var id = $("#approve_id").attr("data");
                $("#h_approve_id").val(id);
                return true;
            }
            return false;
        }

        $("#lableInput").on("keypress", function (e) {
            if (e.keyCode == 13) {
                e.preventDefault();
                saveLabel($(".Lable-a"));
            }
        });
        //机会div隐藏

        function stageHide(){

            $(".fudong_add_td input_dowm").toggle();
        }



        $(document).on('click','.Pop_ddowm_box1 li',function(e){
            var data=$(this).attr("data");
            var html=$(this).text();
            $("input[name=approve_id1]").val(data);

            $("#approve_id1").val(html);
            $(this).closest(".Pop_up_box").hide();

        });
        $(document).on('click','.Pop_ddowm_box2 li',function(e){
            var data=$(this).attr("data");
            var html=$(this).text();
            $("input[name=approve_id2]").val(data);

            $("#approve_id2").val(html);
            $(this).closest(".Pop_up_box").hide();

        });

    </script>
@endsection

@section("right_content")

    <div class="mainWrapBox">
        <div class="mainBox">
            <h1><a href="/backend/items">项目</a> / 填写项目基本信息</h1>

            <form action="/backend/items/create" id="frmProject" enctype="multipart/form-data" method="post">
              {{ csrf_field()  }}
                <div class="html">
                    <div class="body">
                        <table cellpadding="0" cellspacing="0" id="xiangmu_mb_cont" class="xiansuo_add">
                            <tbody>
                            <tr>
                                <td width="140" align="right" class="padd-right10">项目名称<em class="colorf00">*</em></td>
                                <td width="640" colspan="5" class="xiansuo_add_sc">
                                    <input type="text" class="xiansuo_inss width590" style="width: 360px" name="project.name1" maxlength="30" placeholder="楼盘名" />
                                    -
                                    <input type="text" class="xiansuo_inss width590" style="width: 220px" name="project.name2" maxlength="30" placeholder="楼栋名" />
                                    <p class="valid-error" style="display: none;color: red;">必选字段</p>
                                </td>

                            </tr>
                            <tr>
                                <td width="140" align="right" class="padd-right10">项目所在地</td>
                                <td width="1040" colspan="5" class="xiansuo_add_sc">

                                    <div id="shenshi">
                                        <select name="project.province" id="s_province" class="width100 shigh" onchange="changeProvince(this,&#39;s_city&#39;)"></select>
                                        <select id="s_city" name="project.city" class="width100 shigh"></select>
                                        <input name="project.address" type="text" placeholder="地址" onblur="access_location()" id="address" class="xiansuo_inss width370  mr10" style="width:383px;" maxlength="100">
                                    </div>

                                </td>

                            </tr>
                            <!---->
                            <tr>
                                <td width="140" align="right" valign="top" class="padd-right10">情况描述</td>
                                <td width="640" colspan="5" ><textarea name="project.content" class="xiansuo_inss width590 height100 " maxlength="1000"></textarea></td>
                            </tr>
                            <tr>
                                <td width="140" align="right" valign="top" class="padd-right10">考核要求</td>
                                <td width="640" colspan="5" ><textarea name="project.content1" class="xiansuo_inss width590 height100 " maxlength="1000"></textarea></td>
                            </tr>
                            <tr>
                                <td width="140"  align="right" class="padd-right10">保留价</td>
                                <td width="640" colspan="5" ><input type="text" name="project_price" style="width:590px; float:left;"   maxlength="30"><p style="float:left">人民币（1元人民币=5元产值币）</p></td>
                            </tr>
                            <tr>
                                <td width="140" align="right"  class="padd-right10">竞价截止日<em class="colorf00">*</em></td>
                                <td width="640" colspan="5" class="xiansuo_add_sc">
                                    <input type="text" style="width:135px" name="project.expectStartDate" onClick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"/>
                                    <span style="display: none;color:red;">必选字段</span></td>
                            </tr>
                            <tr>
                                <td width="140" align="right"  class="padd-right10">项目完成日<em class="colorf00">*</em></td>
                                <td width="640" colspan="5" class="xiansuo_add_sc">
                                    <input type="text" name="project.expectFinishDate" onClick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})" />
                                    <span style=" display: none;color:red;">必选字段</span></td>
                            </tr>
                            <tr>
                                <td width="140" align="right" class="padd-right10">意见回复日</td>
                                <td width="640" colspan="5" ><input name="idea_deadline" type="text" class="xiansuo_inss width590" maxlength="30"></td>
                            </tr>
                            <tr>
                                <td width="140" align="right" class="padd-right10" >约定设计费</td>
                                <td width="640" colspan="5" ><input type="text" name="item_design" class="xiansuo_inss width590" style="float:left;" maxlength="30"><p style="float:left;">人民币（1元人民币=5元产值币）</p></td>
                            </tr>
                            <tr>
                                <td width="140" align="right" class="padd-right10" >花园顾问</td>
                                <td width="640" colspan="5" class="xiansuo_add_sc">
                                    <div class="pass_shen" style="position: relative;">
                                        <input type="hidden" name="approve_id1" value=""  />
                                        <input  readonly="readonly" type="text" name="project.auditorName" id="approve_id1" class="xiansuo_inss width200 pass_on boxes_cu " value="">
                                        <!---->
                                        <div class="pass_text Pop_up_box Pop_ddowm_box1" style="display: none;">
                                            <div class="pass_con">
                                                <h1>推荐用户</h1>
                                                <ul id="pass_ul" class="pass_con_list mt5 ">
                                                    @foreach($roles as $v)
                                                    <li data="{{ $v['uid'] }}"><a href="javascript:;">{{ $v['name'] }}</a>

                                                        <span class="right gouxuan"></span></li>
                                                    @endforeach
                                                </ul>
                                            </div>
                                        </div>
                                        <!---->
                                    </div>
                                    <!--pass_shen--></td>
                            </tr>
                            <tr>
                                <td width="140" align="right" class="padd-right10" >设计师</td>
                                <td width="640" colspan="5" class="xiansuo_add_sc">
                                    <div class="pass_shen" style="position: relative;">
                                        <input type="hidden" name="approve_id2" value=""  />
                                        <input  readonly="readonly" type="text" name="project.auditorName" id="approve_id2" class="xiansuo_inss width200 pass_on boxes_cu " value="">
                                        <!---->
                                        <div class="pass_text Pop_up_box Pop_ddowm_box2" style="display: none;">
                                            <div class="pass_con">
                                                <h1>推荐用户</h1>
                                                <ul id="pass_ul" class="pass_con_list mt5 ">
                                                    @foreach($roles as $v)
                                                        <li data="{{ $v['uid'] }}"><a href="javascript:;">{{ $v['name'] }}</a>

                                                            <span class="right gouxuan"></span></li>
                                                    @endforeach
                                                </ul>
                                            </div>
                                        </div>
                                        <!---->
                                    </div>
                                    <!--pass_shen--></td>
                            </tr>
                            <tr>
                                <td width="140" align="right" class="padd-right10">面积</td>
                                <td width="140" colspan="5" >
                                    <input name="area" type="text" class="xiansuo_inss" maxlength="30">平方米
                                    <input name="file[]" type="file" multiple="multiple" >



                                </td>
                            </tr>
                            <tr>
                                <td class="xiansuo_add_sc">

                                </td>
                                <td class="xiansuo_add_sc">

                                    <input id="save" type="submit" value="创建"  class="tank_tab_add left" onclick="return checkProject()">
                                    <input id="cancel" type="button" value="取消"  class="tank_tab_remove left" onclick="remove_tu(&#39;tuandui&#39;)" data="tuandui_remove"></td>
                            </tr>
                            </tbody>

                        </table>
                        <!--jiansuoadd-->
                    </div>

                </div>

            </form></div>


        <script>
        function remove_tu(){
            var url="<?php echo URL('backend/items')?>";
            location.href=url;
        }
    </script>

@endsection

